package com.home.model.service.impl;

import javax.ejb.EJB;
import javax.ejb.Stateless;

import com.home.model.dao.AccountDao;
import com.home.model.dto.AccountDto;
import com.home.model.entity.Account;
import com.home.model.service.AccountService;

/**
 * 
 * @author Kevin Phan
 *
 */
@Stateless
public class AccountServiceImpl implements AccountService {
	
	@EJB
	private AccountDao accountDao;
	
	/**
	 * find account by user name
	 * @param userName
	 * @return
	 */
	public AccountDto findAccountByUserName(String userName) {
		AccountDto accountDto = null;
		Account acc = accountDao.find("userName", userName);
		if (acc != null) {
			accountDto = new AccountDto(acc);
		}
		return accountDto;
	}
	
	
	

}
